#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define N 8005
using namespace std;
inline int read(){
	int x = 0, f = 1; char c = getchar();
	while(c < '0' || c > '9'){if(c == '-')f = -1; c = getchar();}
	while(c >= '0' && c <= '9'){x = (x << 1) + (x << 3) + c - '0'; c = getchar();}
	return x * f;
}
int n, m, a[N], b[N], c[N], d[N];
int main(){
	freopen("sort.in", "r", stdin);
	freopen("sort.out", "w", stdout);
	n = read(), m = read();
	for(int i = 1; i <= n; ++i){
		a[i] = read();
	}
	for(int i = 1; i <= m; ++i){
		int x = read();
		if(x == 1){
			x = read(), a[x] = read();
		}
		else{
			x = read();
			for(int i = 1; i <= n; ++i){
				c[i] = a[i];
				d[i] = i;
			}
			for(int i = 1; i <= n; ++i){
				for(int j = i; j >= 2; --j){
					if(c[j] < c[j - 1]){
						swap(c[j], c[j - 1]);
						swap(d[j], d[j - 1]);
					}
				}
			}
			for(int i = 1; i <= n; ++i){
				b[d[i]] = i;
			}
			printf("%d\n", b[x]);
		}
	}
	return 0;
}
